<template>
  <view class="c-movie-container">
    <image class="poster" mode="widthFix" :src="poster" :lazy-load="true"></image>
    <view class="content">
      <view class="title">
        {{ title }}
        <CTag text="3D"></CTag>
        <CTag></CTag>
        <CTag text="CINITY2D"></CTag>
      </view>
      <view>
        评分: <text class="grade">{{ grade }}</text>
      </view>
      <view class="item-cloumn">
        导演: <text class="text">{{ director }} </text>
      </view>
      <view class="item-cloumn">
        主演: <text class="actor">{{ actor }}</text>
      </view>
    </view>
    <view :class="[isCanBuy ? 'sold-btn' : 'pre-sale-btn']">购票</view>
  </view>
</template>

<script setup>
import { defineProps, ref } from 'vue'
import CTag from '@/components/c-tag'

const props = defineProps({
  title: {
    type: String,
    default: '侏罗纪公园3'
  },
  poster: {
    type: String,
    default: 'https://oss.fxzb.vip/movie/082255cb5c9f690ef09f2ca649f6f7db'
  },
  grade: {
    type: Number,
    default: 8
  },
  type: {
    type: String,
    default: '冒险,奇幻,动画,喜剧'
  },
  director: {
    type: String,
    default: '布赖恩·哈尔'
  },
  actor: {
    type: String,
    default: '布赖恩·哈尔/安迪·萨姆伯格/赛琳娜·戈麦斯'
  },
  isCanBuy: {
    type: Boolean,
    default: false
  }
})
</script>

<style lang="scss">
@import '@/assets/styles/custom_theme.scss';
.c-movie-container {
  display: flex;
  align-items: center;
  padding: 10px;
  margin: 12px 0;
  border-radius: 10px;
  background: #fff;
  .poster {
    width: 68px;
    height: 96px;
    border-radius: 4px;
  }
  .content {
    flex: 1;
    font-size: 13px;
    color: $text-color;
    height: 96px;
    line-height: 20px;
    padding-left: 10px;
    .title {
      color: $title-color;
      font-size: 14px;
      line-height: 26px;
      font-weight: 600;
    }
    .grade {
      color: $grade-color;
      font-weight: 600;
    }
    .grade .actor,
    .director {
      padding-left: 4px;
    }
    .item-cloumn {
      text-overflow: -o-ellipsis-lastline;
      overflow: hidden;
      text-overflow: ellipsis;
      display: -webkit-box;
      -webkit-line-clamp: 1;
      line-clamp: 1;
      -webkit-box-orient: vertical;
    }
  }
  .pre-sale-btn,
  .sold-btn {
    color: #fff;
    font-size: 11px;
    padding: 6px 16px;
    border-radius: 20px;
  }
  .pre-sale-btn {
    background: $secound-btn-bg-color;
    &:active {
      background: #27acff;
    }
  }
  .sold-btn {
    background: $primary-btn-bg-color;
    &:active {
      background: pink;
    }
  }
}
</style>
